#include "05_MyTask.hpp"
#include "06_WorkThread.hpp"
#include <unistd.h>
#include <vector>

//using std::vector;
using std::make_unique;

void test(){
    printf("main | 开始创建Threadpool对象\n");
    ThreadPool threadpool(4, 10);

    printf("main | 开始运行Threadpool\n");
    threadpool.start();
    
    // 没有消费者的情况下，先执行创建任务会被阻塞
    printf("main | 开始创建进程\n");
    for(int i = 0; i < 20; ++i){
        threadpool.addTask(new MyTask());
    }

    sleep(30);

    for(int i = 0; i < 20; ++i){
        threadpool.addTask(new MyTask());
    }
    
    printf("main | 停止运行Threadpool\n");
    threadpool.stop();
}

int main()
{
    test();
    return 0;
}

